package dto;
// Generated Mar 20, 2013 5:08:51 PM by Hibernate Tools 3.2.1.GA

import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 * OrderItems generated by hbm2java
 */
@Entity
@Table(name = "Order_Items", schema = "dbo", catalog = "AntiqueShop")
@XmlRootElement
public class OrderItems implements java.io.Serializable {
    @XmlAttribute(name="id", required=true)
    private int id;
    @XmlTransient
    private Order order;
    @XmlElement(name="product", required=true)
    private Product product;
    @XmlElement(name="deleveredDatetime", required=false)
    private Date deliveredDatetime;
    @XmlElement(name="quantity", required=true)
    private int quantity;
    @XmlTransient
    private boolean isDeleted;
    @XmlElement(name="price", required=true)
    private double price;

    public OrderItems() {
        this.isDeleted = false;
    }

    public OrderItems(int id, Order order, Product product, Date deliveredDatetime, int quantity, boolean isDeleted, double price) {
        this.id = id;
        this.order = order;
        this.product = product;
        this.deliveredDatetime = deliveredDatetime;
        this.quantity = quantity;
        this.isDeleted = isDeleted;
        this.price = price;
    }

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "order_id", nullable = false)
    public Order getOrder() {
        return this.order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    @ManyToOne(cascade=CascadeType.ALL, fetch = FetchType.LAZY)
    @JoinColumn(name = "product_id", nullable = false)
    public Product getProduct() {
        return this.product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "delivered_datetime", nullable = true, length = 23)
    public Date getDeliveredDatetime() {
        return this.deliveredDatetime;
    }

    public void setDeliveredDatetime(Date deliveredDatetime) {
        this.deliveredDatetime = deliveredDatetime;
    }

    @Column(name = "quantity", nullable = false)
    public int getQuantity() {
        return this.quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    @Column(name = "is_deleted", nullable = false)
    public boolean isIsDeleted() {
        return this.isDeleted;
    }

    public void setIsDeleted(boolean isDeleted) {
        this.isDeleted = isDeleted;
    }

    @Column(name = "price", nullable = false, precision = 53, scale = 0)
    public double getPrice() {
        return this.price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
}
